package cn.blog.dao;

import java.util.List;
import java.util.Set;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.blog.entity.SystemRole;
import cn.blog.entity.SystemRoleExample;

@Mapper
public interface SystemRoleMapper {
	long countByExample(SystemRoleExample example);

	int deleteByExample(SystemRoleExample example);

	int deleteByPrimaryKey(Long id);

	int insert(SystemRole record);

	int insertSelective(SystemRole record);

	List<SystemRole> selectByExample(SystemRoleExample example);

	SystemRole selectByPrimaryKey(Long id);

	int updateByExampleSelective(@Param("record") SystemRole record, @Param("example") SystemRoleExample example);

	int updateByExample(@Param("record") SystemRole record, @Param("example") SystemRoleExample example);

	int updateByPrimaryKeySelective(SystemRole record);

	int updateByPrimaryKey(SystemRole record);

	@Select("SELECT r.* FROM system_role r INNER JOIN system_user_role ur ON r.id=ur.roleid INNER JOIN system_user u ON u.uid=ur.userid AND u.uid=#{uid}")
	Set<SystemRole> selectByUid(String uid);
}